home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / bsd / dev / ev_keymap.h < prev    next >
Text File  |  1995-02-14  |  4KB  |  106 lines

  1. /*     Copyright (c) 1992 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  *    ev_keymap.h
  4.  *    Defines the structure used for parsing keymappings.  These structures
  5.  *    and definitions are used by event sources in the kernel and by
  6.  *    applications and utilities which manipulate keymaps.
  7.  *    
  8.  * HISTORY
  9.  * 02-Jun-1992    Mike Paquette at NeXT
  10.  *      Created. 
  11.  */
  12. #import <bsd/dev/ev_types.h>    /* Kernel keymap, keyboard info */
  13.  
  14. #define    NX_NUMKEYCODES    128    /* Highest key code is 0x7f */
  15. #define NX_NUMSEQUENCES    128    /* Maximum possible number of sequences */
  16. #define    NX_NUMMODIFIERS    16    /* Maximum number of modifier bits */
  17. #define    NX_BYTE_CODES    0    /* If first short 0, all are bytes (else shorts) */
  18.  
  19. #define    NX_WHICHMODMASK    0x0f     /* bits out of keyBits for bucky bits */
  20. #define    NX_MODMASK    0x10    /* Bit out of keyBits indicates modifier bit */
  21. #define    NX_CHARGENMASK    0x20    /* bit out of keyBits for char gen */
  22. #define    NX_SPECIALKEYMASK 0x40    /* bit out of keyBits for specialty key */
  23. #define    NX_KEYSTATEMASK    0x80    /* OBSOLETE - DO NOT USE IN NEW DESIGNS */
  24.  
  25. /*
  26.  * Special keys currently known to and understood by the system.
  27.  * If new specialty keys are invented, extend this list as appropriate.
  28.  * The presence of these keys in a particular implementation is not
  29.  * guaranteed.
  30.  */
  31. #define NX_NOSPECIALKEY            0xFFFF
  32. #define NX_KEYTYPE_SOUND_UP        0    /* Processed by kernel */
  33. #define NX_KEYTYPE_SOUND_DOWN        1    /* Processed by kernel */
  34. #define NX_KEYTYPE_BRIGHTNESS_UP    2    /* Processed by kernel */
  35. #define NX_KEYTYPE_BRIGHTNESS_DOWN    3    /* Processed by kernel */
  36. #define NX_KEYTYPE_CAPS_LOCK        4    /* Processed by kernel */
  37. #define NX_KEYTYPE_HELP            5
  38. #define NX_POWER_KEY            6
  39. #define NX_UP_ARROW_KEY            7
  40. #define NX_DOWN_ARROW_KEY        8
  41. #define    NX_NUMSPECIALKEYS        9 /* Maximum number of special keys */
  42. // on the 68k, the power key is handled specially... we don't want it scanned
  43. #ifdef m68k
  44. #define NX_NUM_SCANNED_SPECIALKEYS    5 /* First 5 special keys are */
  45.                       /* actively scanned in kernel */
  46. #else
  47. #define NX_NUM_SCANNED_SPECIALKEYS    7 /* First 7 special keys are */
  48.                       /* actively scanned in kernel */
  49. #endif
  50.  
  51. /* Modifier key indices into modDefs[] */
  52. #define NX_MODIFIERKEY_ALPHALOCK    0
  53. #define NX_MODIFIERKEY_SHIFT        1
  54. #define NX_MODIFIERKEY_CONTROL        2
  55. #define NX_MODIFIERKEY_ALTERNATE    3
  56. #define NX_MODIFIERKEY_COMMAND        4
  57. #define NX_MODIFIERKEY_NUMERICPAD    5
  58. #define NX_MODIFIERKEY_HELP        6
  59.  
  60. typedef struct _NXParsedKeyMapping_ {
  61.      /* If nonzero, all numbers are shorts; if zero, all numbers are bytes*/
  62.     short    shorts;
  63.     
  64.     /*
  65.      *  For each keycode, low order bit says if the key
  66.      *  generates characters.
  67.      *  High order bit says if the key is assigned to a modifier bit.
  68.      *  The second to low order bit gives the current state of the key.
  69.      */
  70.     char    keyBits[NX_NUMKEYCODES];
  71.     
  72.     /* Bit number of highest numbered modifier bit */
  73.     int            maxMod;
  74.     
  75.     /* Pointers to where the list of keys for each modifiers bit begins,
  76.      * or NULL.
  77.      */
  78.     unsigned char *modDefs[NX_NUMMODIFIERS];
  79.     
  80.     /* Key code of highest key deinfed to generate characters */
  81.     int            numDefs;
  82.     
  83.     /* Pointer into the keyMapping where this key's definitions begin */
  84.     unsigned char *keyDefs[NX_NUMKEYCODES];
  85.     
  86.     /* number of sequence definitions */
  87.     int            numSeqs;
  88.     
  89.     /* pointers to sequences */
  90.     unsigned char *seqDefs[NX_NUMSEQUENCES];
  91.     
  92.     /* Special key definitions */
  93.     int            numSpecialKeys;
  94.     
  95.     /* Special key values, or 0xFFFF if none */
  96.     unsigned short specialKeys[NX_NUMSPECIALKEYS];
  97.     
  98.     /* Pointer to the original keymapping string */    
  99.     unsigned char *mapping;
  100.     
  101.     /* Length of the original string */
  102.     int    mappingLen;    
  103. } NXParsedKeyMapping;
  104.  
  105.  
  106.